# Python RenderMan Interface Client
PROJECT (PythonRenderManInterfaceClient)

IF (WIN32)
  SET (CMAKE_BUILD_TYPE "Release")
ENDIF (WIN32)

SET ( Python_ADDITIONAL_VERSIONS "3.2" )

INCLUDE(FindPythonLibs)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})

INCLUDE_DIRECTORIES ( . )
INCLUDE_DIRECTORIES ( ../utils )

SET(CMAKE_SWIG_OUTDIR ${CMAKE_BINARY_DIR}/python)
# RIBClient
SET_SOURCE_FILES_PROPERTIES( RIBClient.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES( RIBClient.i PROPERTIES CMAKE_SWIG_FLAGS "-includeall -o RIBClientPYTHON_wrap.cxx")
# RXClient
SET_SOURCE_FILES_PROPERTIES( RXClient.i PROPERTIES CPLUSPLUS ON)
SET_SOURCE_FILES_PROPERTIES( RXClient.i PROPERTIES CMAKE_SWIG_FLAGS "-includeall -o RXClientPYTHON_wrap.cxx")

MESSAGE ( INFO ${PYTHON_LIBRARIES} )

# RIBClient
SWIG_ADD_MODULE ( ribclient python RIBClient.i ParameterList.cpp )
SWIG_LINK_LIBRARIES ( ribclient ${RIBCLIENT_LIBRARIES} utils ${PYTHON_LIBRARIES} glog )
# RXClient
SWIG_ADD_MODULE ( rxclient python RXClient.i ParameterList.cpp )
SWIG_LINK_LIBRARIES ( rxclient ${RIBCLIENT_LIBRARIES} utils ${PYTHON_LIBRARIES} glog )

IF (WIN32)
  SET_TARGET_PROPERTIES ( _ribclient PROPERTIES SUFFIX ".pyd")
  SET_TARGET_PROPERTIES ( _rxclient PROPERTIES SUFFIX ".pyd")
ENDIF (WIN32)

IF (APPLE)
  SET_TARGET_PROPERTIES ( _ribclient PROPERTIES
    LINK_FLAGS "-undefined dynamic_lookup")
  SET_TARGET_PROPERTIES ( _rxclient PROPERTIES
    LINK_FLAGS "-undefined dynamic_lookup")
ENDIF (APPLE)

INSTALL ( TARGETS _ribclient
  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL ( TARGETS _rxclient
  LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX})

INSTALL ( FILES ${CMAKE_BINARY_DIR}/python/ribclient.py
  DESTINATION ${CMAKE_INSTALL_PREFIX})
INSTALL ( FILES ${CMAKE_BINARY_DIR}/python/rxclient.py
  DESTINATION ${CMAKE_INSTALL_PREFIX})

IF (WIN32)
  SET ( CPACK_GENERATOR "ZIP" )
ENDIF (WIN32)
INCLUDE (CPack)
